/**
 * Created with IntelliJ IDEA
 * Description:
 * User:恋恋
 * Date:2022-11-30
 * Time:22:11
 */
public class isAlive {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 3; i++) {

                    try {
                        Thread.sleep(1000);
                        System.out.println("hello");
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        //启动线程
        thread.start();
        while (true){
            Thread.sleep(1000);
            System.out.println(thread.isAlive());
        }

    }
}
